package moxl.relaxng.validation.testsuite.testsuitetests;

import java.util.ArrayList;
import java.util.List;

import moxl.dom.MoxlElement;

import org.junit.internal.runners.CompositeRunner;

public class RelaxNgTestSuite implements RelaxNgTestObject
{
	private final List<RelaxNgTestObject> children = new ArrayList<RelaxNgTestObject>();

	public RelaxNgTestSuite(MoxlElement el)
	{
		for (MoxlElement each : el.getChildElements())
		{
			if (each.getLocalName().equals("testSuite"))
			{
				children.add(new RelaxNgTestSuite(each));
			}
			else if (each.getLocalName().equals("testCase"))
			{
				children.add(new RelaxNgTestCase(each));
			}
		}
	}

	public void contributeTests(CompositeRunner runner, Class<?> klass)
    {
		for (RelaxNgTestObject child : children)
		{
			child.contributeTests(runner, klass);
		}
    }

}
